package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
//model layer package has to be imported

/**
 * Controller class for the address book
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class AddressCtr
{
    
    //declare instance variables to reference containers
    
    private AddressBook addressBook;
    
    public AddressCtr()
    {addressBook=new AddressBook();
    }
    
    
    public Person getPerson(long id)
    {
      return addressBook.getPerson(id);
        
    }
    
    
    public void createPerson(long id, String name, String address, String postalCode, String city, String phone)
    {   
      
       Person p=new Person(id,name,address,postalCode,city,phone);
       addressBook.addPerson(p);
       
    }
    
    public void deletePerson(long id)
    {
       addressBook.removePerson(id);
    }
    
    public void updatePerson(long id,String name,String postalCode,String city,String phone,String address)
    {addressBook.update(id,name,postalCode,city,phone,address);
     
    }
    
    public ArrayList listAllPersons()
    {
     return addressBook.getPersons();
    }
}
